﻿using Microsoft.AspNetCore.Mvc;
using PowerHub.MES.Common.Utility;
using PowerHub.MES.DTO.ProductPlanning.DTO;
using PowerHub.MES.DTO.ProductPlanning.QueryDTO;
using PowerHub.MES.Entities.ProductPlanning;
using PowerHub.MES.IServices.IProductPlanning;
using PowerHub.MES.ReturnEntity;

namespace PowerHub.MES.Controllers.ProductPlanning
{
    /// <summary>
    /// 原料分类
    /// </summary>
    [ApiController]
    [Route("Api/MES/ProductPlanning/[controller]/[action]")]
    public class ProductClassifyController
    {

        private IProductPlanning_ProductClassifyServices _ProductPlanning_ProductClassifyServices;

        public ProductClassifyController(IProductPlanning_ProductClassifyServices ProductClassifyServices)
        {
            _ProductPlanning_ProductClassifyServices = ProductClassifyServices;
        }

        /// <summary>
        /// 获取原料分类列表
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("获取原料分类列表")]
        public async Task<OperationPageResult<List<ProductPlanning_ProductClassifyDTOs>>> GetProductPlanning_ProductClassifyPageListAsync([FromBody] QueryProductPlanning_ProductClassifyDTO pageQuery)
        {
            return await _ProductPlanning_ProductClassifyServices.GetProductPlanning_ProductClassifyPageListAsync(pageQuery);
        }
        
        /// <summary>
        /// 获取原料分类列表(树形）
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("获取原料分类列表(树形）")]
        public async Task<OperationResult<List<ProductPlanning_ProductClassifyDTOTree>>> GetProductPlanning_ProductClassifyTreeListAsync([FromBody] QueryProductPlanning_ProductClassifyDTO pageQuery)
        {
            return await _ProductPlanning_ProductClassifyServices.GetProductPlanning_ProductClassifyTreeListAsync(pageQuery);
        }


        /// <summary>
        /// 批量删除原料分类
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("批量删除原料分类")]
        public async Task<OperationResult<object>> DeletionProductPlanning_ProductClassifyAsync([FromBody] List<string> Query)
        {
            return await _ProductPlanning_ProductClassifyServices.DeletionProductPlanning_ProductClassifyAsync(Query);
        }

        /// <summary>
        /// 更新原料分类
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("更新原料分类")]
        public async Task<OperationResult<object>> UpdateProductPlanning_ProductClassifyAsync([FromBody] ProductPlanning_ProductClassifyDTO Query)
        {
            return await _ProductPlanning_ProductClassifyServices.UpdateProductPlanning_ProductClassifyAsync(Query);
        }

        /// <summary>
        /// 添加原料分类
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("添加原料分类")]
        public async Task<OperationResult<object>> CreateProductPlanning_ProductClassifyAsync([FromBody] ProductPlanning_ProductClassifyDTO Query)
        {
            return await _ProductPlanning_ProductClassifyServices.CreateProductPlanning_ProductClassifyAsync(Query);
        }
    }
}
